import service from '@/utils/request'
// /company/department
export const departs = () => {
  return service('/company/department')
}

// 添加部门
/* Path： /company/department

Method： POST */
export const addDeparts = ({ code, introduce, manager, name, pid }) => {
  return service({
    url: '/company/department',
    method: 'post',
    data: {
      code,
      introduce,
      manager,
      name,
      pid
    }
  })
}

// 修改部门
// Path： /company/department/{id}

// Method： PUT
export const editDeparts = ({
  code,
  introduce,
  manager,
  name,
  pid,
  companyId,
  createTime,
  id,
  managerId
}) => {
  return service({
    url: `/company/department/${id}`,
    method: 'put',
    data: {
      code,
      introduce,
      manager,
      name,
      pid,
      companyId,
      createTime,
      id,
      managerId
    }
  })
}

// 查询部门
// Path： /company/department/{id}

// Method： GET
export const queryDeparts = id => {
  return service({
    url: `/company/department/${id}`
  })
}

// 删除部门
// Path： /company/department/{id}

// Method： DELETE
export const deleteDeparts = id => {
  return service({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
